package com.yunwaikeji.gy_tool_library.io;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.yunwaikeji.gy_tool_library.info.GYFileInfo;
import com.yunwaikeji.gy_tool_library.utils.file.delete.FileDeleteListener;
import com.yunwaikeji.gy_tool_library.utils.file.GYFileUtils;

import java.io.File;
import java.net.URI;

public class GYFile extends File implements GYFileInfo {
    public GYFile(@NonNull String pathname) {
        super(pathname);
    }

    public GYFile(@Nullable String parent, @NonNull String child) {
        super(parent, child);
    }

    public GYFile(@Nullable File parent, @NonNull String child) {
        super(parent, child);
    }

    public GYFile(@NonNull URI uri) {
        super(uri);
    }

    public void delete(DeleteType deleteType) {
        delete(deleteType, null);
    }

    public void delete(DeleteType deleteType, FileDeleteListener fileDeleteListener) {
        GYFileUtils.newFileDeleteTask()
                .setFile(this)
                .setDeleteType(deleteType)
                .setFileDeleteListener(fileDeleteListener)
                .start();
    }
}
